/*
 * TxConstants.java Copyright PrinceEgg Tech Co. Ltd. All Rights Reserved.
 */
package org.infohold.mysql.conf;

/**
 * 事务常量定义
 * 
 * @since 2018-07-04
 * @author kangLiu
 */
public interface TxConstants {
    /**
     * 默认事务切面表达式（默认为com.xfqb下biz包拦截所有方法）
     */
	String DEFAULT_TX_AOP_EXPRESSION = "(execution(* com.infohold..biz..*.*(..)) && "
                                       + "!@target(org.springframework.transaction.annotation.Transactional) && "
                                       + "!@annotation(org.springframework.transaction.annotation.Transactional))";

    /**
     * 默认的事务AOP顺序
     */
    int DEFAULT_TX_AOP_ORDER = 2147483647;

    /**
     * 只读
     */
    String READ_ONLY = "readOnly";

    /**
     * 读写事务级别
     */
    String LEVEL_PROPAGATION_REQUIRED = "PROPAGATION_REQUIRED,-Exception";

    /**
     * 只读事务级别
     */
    String LEVEL_PROPAGATION_SUPPORTS = "PROPAGATION_SUPPORTS,readOnly,-Exception";

    /**
     * 全局事务方法前缀：*
     */
    String FUNC_PREFIX_ALL = "*";

    /**
     * 写事务方法前缀：存储
     */
    String FUNC_PREFIX_SAVE = "save*";

    /**
     * 写事务方法前缀：存储
     */
    String FUNC_PREFIX_INSERT = "insert*";

    /**
     * 写事务方法前缀：修改
     */
    String FUNC_PREFIX_UPDATE = "update*";

    /**
     * 写事务方法前缀：修改
     */
    String FUNC_PREFIX_MODIFY = "modify*";

    /**
     * 写事务方法前缀：删除
     */
    String FUNC_PREFIX_REMOVE = "remove*";

    /**
     * 写事务方法前缀：删除
     */
    String FUNC_PREFIX_DELETE = "delete*";

    /**
     * 写事务方法前缀
     */
    String[] TX_WRITE_FUNC_LIST = {FUNC_PREFIX_SAVE, FUNC_PREFIX_INSERT, FUNC_PREFIX_UPDATE,
        FUNC_PREFIX_MODIFY, FUNC_PREFIX_REMOVE, FUNC_PREFIX_DELETE};

    /**
     * 读事务方法前缀：装载
     */
    String FUNC_PREFIX_LOAD = "load*";

    /**
     * 读事务方法前缀：查询
     */
    String FUNC_PREFIX_LIST = "list*";

    /**
     * 读事务方法前缀：获取
     */
    String FUNC_PREFIX_GET = "get*";

    /**
     * 读事务方法前缀：计数
     */
    String FUNC_PREFIX_COUNT = "count*";

    /**
     * 读事务方法前缀
     */
    String[] READ_FUNC_LIST = {FUNC_PREFIX_LOAD, FUNC_PREFIX_LIST, FUNC_PREFIX_GET,
        FUNC_PREFIX_COUNT};

}
